import 'package:flutter/material.dart';
import 'package:myturngame/common/game_global.dart';
import 'package:myturngame/widget/home/dialog_skill.dart';
import 'package:provider/provider.dart';

import '../../bean/skill/skill.dart';
import '../../state/SelectSkillChangeNotifier.dart';

///技能指令对话框
class DialogSkillCommand extends StatelessWidget {
  Function skillSelect;
  DialogSkillCommand(this.skillSelect,{Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Dialog(
      child:Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          const SkillLookLayout(),
          const Divider(height: 10),
          OutlinedButton(onPressed: () {
            var selectSkill = Provider.of<SelectSkillChangeNotifier>(context,listen: false).selectSkill;
            if(selectSkill!=null){
              skillSelect();
              Navigator.pop(context);
              debugPrint("关闭对话框");
            }
          }, child: const Text("确定"))
        ],
      ),
    );
    ;
  }
}
